package com.tianlaiedu.service.impl;

import com.tianlaiedu.bean.Userdata;
import com.tianlaiedu.dao.UserMapper;
import com.tianlaiedu.dao.UserdataMapper;
import com.tianlaiedu.service.UserDataService;
import org.apache.ibatis.session.SqlSession;

/**
 * @author:hejing
 * @date:2021/11/30
 */
public class UserDataServiceImpl implements UserDataService {
    @Override
    public int addUserData(Userdata userdata) {
        try (SqlSession sqlSession=com.tianlaiedu.utils.MapperUtil.getSqlSessionFactory().openSession(true)){
          final   UserdataMapper mapper = sqlSession.getMapper(UserdataMapper.class);
            return mapper.addUserData(userdata);
        }

    }

    @Override
    public Userdata findByid(int id) {

        try (SqlSession sqlSession=com.tianlaiedu.utils.MapperUtil.getSqlSessionFactory().openSession(true)){
            final   UserdataMapper mapper = sqlSession.getMapper(UserdataMapper.class);
            return mapper.findByid(id);
        }
    }
}
